<?php

namespace app\modules\merchant\services;

use app\common\services\BaseService;
use app\models\GoodsOrderCredential;
use app\modules\merchant\forms\order\AdjustForm;

class GoodsOrderCredentialService extends BaseService{

    /**
     * 创建
     * @param AdjustForm $form
     * @return bool
     * @throws \Throwable
     */
    public static function create(AdjustForm $form){
        $model = new GoodsOrderCredential();
        $model->setAttributes($form->getAttributes(),false);
        return $model->insert() !== false;
    }

    /**
     * 获取信息
     * @param $merchant_id
     * @param $order_id
     * @return GoodsOrderCredential[]
     */
    public static function getInfoById($merchant_id,$order_id){
        return GoodsOrderCredential::findAll(['merchant_id'=>$merchant_id,'order_id'=>$order_id]);
    }
}